package com.xh.fma.commodity.entity;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.xh.common.exceptiongroup.SaveGroup;
import com.xh.common.exceptiongroup.UpdateGroup;
import com.xh.common.exceptiongroup.UpdateIsshowGroup;
import com.xh.common.valid.EnumValidate;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 家居品牌
 * 
 * @author sjf
 * @email xhyy7762@gmail.com
 * @date 2023-05-18 17:45:54
 */
@Data
@TableName("commodity_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * id
	 */
	@TableId
	@Null(groups = {SaveGroup.class},message = "添加不能指定id")
	@NotNull(groups = {UpdateIsshowGroup.class})
	private Long id;
	/**
	 * 品牌名
	 */
	@NotBlank(groups = {SaveGroup.class, UpdateGroup.class},message = "名字不能为空")
	private String name;
	/**
	 * logo
	 */
	@NotBlank(groups = {SaveGroup.class},message = "您未上传logo")
	@URL(groups = {SaveGroup.class},message = "您上穿的logo不符合要求")
	private String logo;
	/**
	 * 说明
	 */
	@NotBlank(groups = {SaveGroup.class, UpdateGroup.class},message = "说明不能为空")
	private String description;
	/**
	 * 显示
	 */
	@NotNull(groups = {SaveGroup.class, UpdateGroup.class,}, message = "显示不能为空")
	//@Pattern(regexp = "^[0-1]$")  对数字的正则表达式校验是无效的
	@EnumValidate(values = {0,1},groups = {SaveGroup.class, UpdateGroup.class,UpdateIsshowGroup.class})
	private Integer isshow;
	/**
	 * 检索首字母
	 */
	@NotBlank(groups = {SaveGroup.class, UpdateGroup.class}, message = "检索首字母不能为空")
	@Pattern(groups = {SaveGroup.class, UpdateGroup.class}, regexp = "^[a-zA-Z]$" , message = "必须输入a-z或A-Z之间")
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(groups = {SaveGroup.class, UpdateGroup.class}, message = "排序值不能玩为空")
	@Min(groups = {SaveGroup.class, UpdateGroup.class}, value = 0,message = "排序值不能小于0")
	private Integer sort;

}
